<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<style>
    .title {
        background-color: aqua;
    }
</style>

<body>
    <div id="test"></div>
    <div id="root"></div>
</body>
<!-- 核心 -->
<script type="text/javascript" src="./js/react.development.js"></script>

<!-- 虚拟DOM -->
<script type="text/javascript" src="./js/react-dom.development.js"></script>

<!-- 用于将jsx转化为js -->
<script type="text/javascript" src="./js/babel.min.js"></script>

<script type="text/babel">
    const data =['Angular','React','Vue']
    // 1.创建虚拟DOM
    const VDOM = (
        <div>
            <h1>前端js框架列表</h1>
        <ul>
            {
                data.map((item,index)=>{
                    return <li key={index}>{item}</li>
                })
            }
        </ul>    
        </div>
    )
    // 2.渲染虚拟DOM到页面
    ReactDOM.render(VDOM, document.querySelector('#test'))

    function tick(){
        const element = (
            <h2>{new Date().toLocaleTimeString()}</h2>
        )
        ReactDOM.render(element,document.getElementById('root'))
    }

    setInterval(tick,1000)

</script>

</html>